﻿using BwTMusicServices.Country;
using BwTMusicServices.Genre;
using BwTMusicServices.Music;
using BwTMusicServices.Singer;
using BwTMusicServices.Theme;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace BwTMusic.Controllers
{
    public class HomeController : Controller
    {
        MusicServices music = new MusicServices();
        SingerServices singer = new SingerServices();
        CountryServices _services = new CountryServices();
        GenreServices genre = new GenreServices();
        ThemeServices theme = new ThemeServices();
        public ActionResult Index()
        {
            return View();
        }
      
        public ActionResult SearchMusic()
        {        
            return View();
        }
     
        public JsonResult GetAllCountryMusic()
        {
            return Json(new { data = _services.GetAllCountrys(), statusCode = 1, message = "查询成功", success = true }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetAllThemeMusic()
        {
            return Json(new { data = theme.GetThemeList(), statusCode = 1, message = "查询成功", success = true }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetAllGenreMusic()
        {
            return Json(new { data = genre.GetGenreList(), statusCode = 1, message = "查询成功", success = true }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult SearchKey(int CurrentPage,string keyWord)
        {
            return Json(new { data = music.GetAllNorthMusicForKey(CurrentPage,keyWord,out int total), statusCode = 1, message = "查询成功", success = true, totalCount = total }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult SearchAlbumKey(int CurrentPage, string keyWord)
        {
            return Json(new { data = music.GetAllNorthAlbumForKey(CurrentPage, keyWord, out int total), statusCode = 1, message = "查询成功", success = true, totalCount = total }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetTopSixSinger()
        {
            return Json(new { data = singer.GetTopSixSinger(), statusCode = 1, message = "查询成功", success = true }, JsonRequestBehavior.AllowGet);
        }
       public ActionResult IndexMobile()
        {
            return View();
        }
    }
}